/*
 * 标注员每日产值记录相关API
 */
import * as API from "./api";

/**
 * 分页查询标注员每日产值记录列表
 * @param {Object} params {currentPage, pageSize, labelerName, startDate, endDate}
 */
export const getLabelerDailyOutputListAPI = (params) => {
  return API.GET('/admin/labeler-daily-output', params);
};

/**
 * 新增标注员每日产值记录
 * @param {Object} data 标注员每日产值记录数据
 */
export const addLabelerDailyOutputAPI = (data) => {
  return API.POST('/admin/labeler-daily-output', data);
};

/**
 * 批量新增标注员每日产值记录
 * @param {Array} dataList 标注员每日产值记录数据列表
 */
export const batchAddLabelerDailyOutputAPI = (dataList) => {
  return API.POST('/admin/labeler-daily-output/batch', dataList);
};

/**
 * 修改标注员每日产值记录
 * @param {Number} id 记录ID
 * @param {Object} data 标注员每日产值记录数据
 */
export const updateLabelerDailyOutputAPI = (id, data) => {
  return API.PUT(`/admin/labeler-daily-output/${id}`, data);
};

/**
 * 删除标注员每日产值记录
 * @param {Number} id 记录ID
 */
export const deleteLabelerDailyOutputAPI = (id) => {
  return API.DELETE(`/admin/labeler-daily-output/${id}`);
};

/**
 * 获取标注员每日产值统计图表数据
 * @param {Object} params {startDate, endDate}
 */
export const getLabelerDailyOutputChartDataAPI = (params) => {
  return API.GET('/admin/labeler-daily-output/chart-data', params);
};

/**
 * 下载导入模板
 */
export const downloadImportTemplateAPI = () => {
  return API.FILE({
    method: 'get',
    url: '/admin/labeler-daily-output/template',
    responseType: 'blob'
  });
};

/**
 * 导入标注员每日产值记录数据
 * @param {File} file 包含Excel文件
 * @param {Object} config 配置对象，支持onProgress回调
 */
export const importLabelerDailyOutputAPI = (file, config = {}) => {
  const formData = new FormData();
  formData.append('file', file);
  return API.FILESubmit('/admin/labeler-daily-output/import', formData, config);
};

/**
 * 导出标注员每日产值记录数据
 * @param {Object} params 查询参数
 */
export const exportLabelerDailyOutputAPI = (params) => {
  return API.FILE({method: 'get', url: '/admin/labeler-daily-output/export', responseType: 'blob'}, null, params);
};